Software upgrade method and system for mobile terminal

ABSTRACT

A software upgrade method and system for a mobile terminal includes locating partition tables of a new version of software and an old version of software, generating a corresponding backup list, scanning all files of the new version of software, generating a differential upgrade package that comprises a partition table of the new version of software and the backup list, saving backup data, to be backed up in the mobile terminal, into a SD card according to the backup list, re-partitioning a mobile terminal memory according to the partition table of the new version of software in the differential upgrade package, correspondingly writing the backup data on the SD card into the partition, decompressing the differential upgrade package to obtain a corresponding differentiating file, generating corresponding new version files according to the differentiating file and the old version files in the mobile terminal, and writing into the mobile terminal.

FIELD OF THE INVENTION

The present invention relates to the field of mobile terminals, and inparticular relates to a software upgrade method and system for a mobileterminal.

DESCRIPTION OF THE RELATED ART

Existing smartphones, such as a cell phone with an Android system, oftenneed to upgrade software. Generally, a FOTA (Firmware Over-The-Air)upgrade is used. The FOTA upgrade is a simple and friendly upgrademethod, which can upgrade the cell phone software to the latest versionalmost without asking a user to carry out any operation. Given thecurrent tendency that the development of smartphones is fast, however,there are often situations in which the memory partition table of a cellphone needs to be revised due to the software version upgrade (orchanges to software requirements). The existing FOTA mechanism is unableto handle this type of situations.

Specifically in the field of mobile terminals and the entire embeddedfield, with a cell phone as an example, there are typically two types ofstorage media, one is cell phone memory, which is typically a NAND orEMMC and is the core storage space for the cell phone; two is expandedmemory, which is typically a SD card. There are two types of cell phonememory partitions (the partition hereinafter refers in particular tocell phone memory partition, and the partition table refers inparticular to the partition table of a cell phone memory). One is theraw data type, i.e. writing and reading data in the form of raw datastream, and this type of partitions include bootloader, kernel, etc. Theother type is the filesystem type. The file herein means computer file,which refers to a set of some data. One file represents a set of data.In this type of partitions, a file system (e.g. EXT4 or FAT) will bedeployed to manage all files. If we need to read or write a file, weneed to need to read or write by following the reading or writing modeof the file system. On a typical cell phone apparatus, both the systempartition and the userdata partition belong to this type. Figuratively,the filesystem type partition is like a book having a table of contents.The table of contents is the META data in the partition regarding filelist, file attributes, and file size. On the other hand, the raw datatype partition is like a book without a table of contents. According tothe actual situation of the cell phone (embedded) field, it can besimply summarized that the raw data type partition may store one file,and the filesystem type partition may store multiple files. As describedabove, each partition has a conventional type, and therefore, thepartition type will usually not change.

Given the current tendency that the development of smartphones is fast,however, there are often situations in which the memory partition tableof a cell phone needs to be revised due to the software version upgrade(or changes to software requirements). Changes to a partition tableinclude changes to the starting address and to the size of thepartitions. Such changes to the starting address and to the size of thepartitions are fatal to a filesystem type partition, as this type ofchanges may very likely corrupt META data. Once the META data iscorrupted, some files in the partition cannot be read or written.Although a raw data type partition does not have META data, this type ofchanges may still likely corrupt data in the partition. Moreover, theFOTA mechanism is based on a file differential algorithm and all of itsoperations are file operations. In the event that files are corrupted,the FOTA operations will certainly fail. However, the existing FOTAmechanism does not provide relevant measures for “changes to a partitiontable of a memory between new and old versions of the software”. As aresult, the existing FOTA mechanism is unable to process this type ofsituations. Since the existing FOTA upgrade method cannot handle thistype of situations, it will make the development more difficult if theoriginal partition table has to be kept, and moreover, users will not beable to have the latest and the best user experience.

Therefore, the prior art still needs to be improved and developed.

SUMMARY OF THE INVENTION

The technical problem that the present invention intends to solve is, inlight of the above drawbacks of the prior art, to provide a softwareupgrade method and system for a mobile terminal which is intended tosolve the problem of inconvenient software upgrade according to theprior art.

The present invention employs the following technical solution to solvethe technical problem:

A software upgrade method for a mobile terminal, wherein it comprisesthe following steps:

A. According to the new version software and the old version software,locating partition tables of the new version software and the oldversion software, respectively, comparing the difference between the newand old partition tables, and generating a corresponding backup list;

B. Scanning all files of the new version software and generating adifferential upgrade package that comprises the partition table of saidnew version software and the backup list;

C. According to the backup list in said differential upgrade package,detecting the total size of the backup data to be backed up in themobile terminal, and comparing said total size of the backup data withthe remaining space of the SD card of the mobile terminal, and when saidtotal size of the backup data is smaller than the remaining space of theSD card of the mobile terminal, going to Step D;

D. Saving the backup data to be backed up in the mobile terminal intothe SD card according to said backup list, re-partitioning the mobileterminal memory according to said partition table of the new versionsoftware in said differential upgrade package, detecting the partitiontype, and correspondingly writing the backup data on the SD card intothe partition;

E. Decompressing said differential upgrade package to obtain acorresponding differentiating file, generating corresponding new versionfiles according to said differentiating file and the old version filesin the mobile terminal, and writing into the mobile terminal to completethe upgrade.

The software upgrade method for a mobile terminal, wherein Step Aspecifically comprises:

A1. According to the new version software and the old version software,acquiring partition tables of the new version software and the oldversion software, respectively;

A2. Traversing the partition table of the new version, if traversal isnot completed, going to Step A3; if traversal is completed, ending;

A3. Taking one item from the new partition table, and checking if apartition in the old partition table has the same name, if yes, going toStep A4; if no, going to Step A2;

A4. Checking if both new and old partitions have the same size andstarting address, if yes, going to Step A2; if no, going to Step A5;

A5. Checking the partition type, adding a description item in the backuplist to describe the name and type of said partition, and returning toStep A2.

The software upgrade method for a mobile terminal, wherein Step Bspecifically comprises:

B1. Scanning all files of the new version and old version softwarepackages and obtaining corresponding file lists, respectively;

B2. Traversing the partition table of the new version, if traversal isnot completed, going to Step B3; if traversal is completed, adding thepartition table of the new version into the differential upgradepackage, and ending;

B3. Taking one item from the file list of the new version, and checkingif a file in the file list of the old version has the same file name, ifno, adding the file of the new version into the differential upgradepackage in a word by word manner, and going to Step B2; if yes,continuing to Step B4;

B4. In a differentiating package comparison tool, using files of the newversion and old version as input to generate a differentiating file,adding a corresponding description item in the differentiating file, andreturning to Step B2.

The software upgrade method for a mobile terminal, wherein Step Cspecifically comprises:

C1. Checking if the mobile terminal has a SD card, if yes, going to StepC2; if no, reporting an error, and ending;

C2. Acquiring the backup list from the differential upgrade package,reading the existing partition table from the mobile terminal memory,traversing the backup list, if traversal is not completed, going to StepC3; if traversal is completed, going to Step C4;

C3. Taking one item from the backup list, locating the correspondingpartition in the existing partition table, checking the partition type,if it is a partition of raw data type, adding cumulatively thepartitions until the size is up to the total size of the backup data; ifit is a partition of filesystem type, adding cumulatively the total sizeof all files in the partition up to the total size of the backup data;returning to Step C2 until traversal is completed;

C4. Checking the size of the remaining space of the SD card of themobile terminal, if it is larger than the total size of the backup data,going to Step D; otherwise, reporting an error, and ending.

The software upgrade method for a mobile terminal, wherein Step Dspecifically comprises:

D1. Acquiring the backup list from the differential upgrade package,reading the existing partition table from the mobile terminal memory,traversing the backup list, if traversal is not completed, going to StepD2; if traversal is completed, going to Step D3;

D2. Taking one item from the backup list, locating the correspondingpartition in the existing partition table, checking the partition type,if it is a partition of raw data type, reading data from the wholepartition, and saving these data as one file on the SD card; if it is apartition of filesystem type, packing files in the partition to one filein the TAR file format, and saving this file onto the SD card; returningto Step D1 until traversal is completed;

D3. Acquiring the new partition table from the differential upgradepackage, re-partitioning the mobile terminal memory according to the newpartition table, traversing the backup list, if traversal is notcompleted, going to Step D4; if traversal is completed, ending;

D4. Taking one item from the backup list, locating the correspondingpartition in the new partition table, checking the partition type, if itis a partition of raw data type, writing the corresponding file that isbacked up on the SD card into the partition; if it is a partition offilesystem type, decompressing the corresponding TAR file that is backedup on the SD card, and writing all files in the TAR file into thepartition, and returning to Step D3 until traversal is completed.

The software upgrade method for a mobile terminal, wherein Step Especifically comprises:

E1. Decompressing the differential upgrade package to obtain thecorresponding differentiating file and the differentiating file list,traversing the differentiating file list, if traversal is not completed,going to Step E2; if traversal is completed, ending;

E2. Taking one item from the differentiating file list, generatingcorresponding new version files according to said differentiating fileand the old version files in the mobile terminal, writing into themobile terminal, and returning to Step E1 until traversal is completed.

A software upgrade method for a mobile terminal, wherein it comprisesthe following steps:

A. According to the new version software and the old version software,locating partition tables of the new version software and the oldversion software, respectively, comparing the difference between the newand old partition tables, and generating a corresponding backup list;

B. Scanning all files of the new version software and generating adifferential upgrade package that comprises the partition table of saidnew version software and the backup list;

C. According to the backup list in said differential upgrade package,detecting the total size of the backup data to be backed up in themobile terminal, and comparing said total size of the backup data withthe remaining space of the SD card of the mobile terminal, and when saidtotal size of the backup data is smaller than the remaining space of theSD card of the mobile terminal, going to Step D;

D. Saving the backup data to be backed up in the mobile terminal intothe SD card according to said backup list, re-partitioning the mobileterminal memory according to said partition table of the new versionsoftware in said differential upgrade package, detecting the partitiontype, and correspondingly writing the backup data on the SD card intothe partition;

E. Decompressing said differential upgrade package to obtain acorresponding differentiating file, generating corresponding new versionfiles according to said differentiating file and the old version filesin the mobile terminal, and writing into the mobile terminal to completethe upgrade;

wherein, the partition table in Step A has two forms: at a PC end, thepartition table is present in the form of a partition table descriptionfile, which comprises partition name, partition size, partition startingaddress and partition type; at a cell phone end, the partition table ispresent in the form of memory header data and memory internal partitiontable data, which also comprises partition name, partition size,partition starting address and partition type; then, the PC end comparesthe difference between the new and old partition tables, and generates acorresponding backup list;

Step E specifically comprises:

E1. Decompressing the differential upgrade package to obtain thecorresponding differentiating file and the differentiating file list,traversing the differentiating file list, if traversal is not completed,going to Step E2; if traversal is completed, ending;

E2. Taking one item from the differentiating file list, generatingcorresponding new version files according to said differentiating fileand the old version files in the mobile terminal, writing into themobile terminal, and returning to Step E1 until traversal is completed.

The software upgrade method for a mobile terminal, wherein Step Aspecifically comprises:

A1. According to the new version software and the old version software,acquiring partition tables of the new version software and the oldversion software, respectively;

A2. Traversing the partition table of the new version, if traversal isnot completed, going to Step A3; if traversal is completed, ending;

A3. Taking one item from the new partition table, and checking if apartition in the old partition table has the same name, if yes, going toStep A4; if no, going to Step A2;

A4. Checking if both new and old partitions have the same size andstarting address, if yes, going to Step A2; if no, going to Step A5;

A5. Checking the partition type, adding a description item in the backuplist to describe the name and type of said partition, and returning toStep A2.

The software upgrade method for a mobile terminal, wherein Step Bspecifically comprises:

B1. Scanning all files of the new version and old version softwarepackages and obtaining corresponding file lists, respectively;

B2. Traversing the partition table of the new version, if traversal isnot completed, going to Step B3; if traversal is completed, adding thepartition table of the new version into the differential upgradepackage, and ending;

B3. Taking one item from the file list of the new version, and checkingif a file in the file list of the old version has the same file name, ifno, adding the file of the new version into the differential upgradepackage in a word by word manner, and going to Step B2; if yes,continuing to Step B4;

B4. In a differentiating package comparison tool, using files of the newversion and old version as input to generate a differentiating file,adding a corresponding description item in the differentiating file, andreturning to Step B2.

The software upgrade method for a mobile terminal, wherein Step Cspecifically comprises:

C1. Checking if the mobile terminal has a SD card, if yes, going to StepC2, if no, reporting an error, and ending;

C2. Acquiring the backup list from the differential upgrade package,reading the existing partition table from the mobile terminal memory,traversing the backup list, if traversal is not completed, going to StepC3; if traversal is completed, going to Step C4;

C3. Taking one item from the backup list, locating the correspondingpartition in the existing partition table, checking the partition type,if it is a partition of raw data type, adding cumulatively thepartitions until the size is up to the total size of the backup data; ifit is a partition of filesystem type, adding cumulatively the total sizeof all files in the partition up to the total size of the backup data;returning to Step C2 until traversal is completed;

C4. Checking the size of the remaining space of the SD card of themobile terminal, if it is larger than the total size of the backup data,going to Step D; otherwise, reporting an error, and ending.

The software upgrade method for a mobile terminal, wherein Step Dspecifically comprises:

D1. Acquiring the backup list from the differential upgrade package,reading the existing partition table from the mobile terminal memory,traversing the backup list, if traversal is not completed, going to StepD2; if traversal is completed, going to Step D3;

D2. Taking one item from the backup list, locating the correspondingpartition in the existing partition table, checking the partition type,if it is a partition of raw data type, reading data from the wholepartition, and saving these data as one file on the SD card; if it is apartition of filesystem type, packing files in the partition to one filein the TAR file format, and saving this file onto the SD card; returningto Step D1 until traversal is completed;

D3. Acquiring the new partition table from the differential upgradepackage, re-partitioning the mobile terminal memory according to the newpartition table, traversing the backup list, if traversal is notcompleted, going to Step D4; if traversal is completed, ending;

D4. Taking one item from the backup list, locating the correspondingpartition in the new partition table, checking the partition type, if itis a partition of raw data type, writing the corresponding file that isbacked up on the SD card into the partition; if it is a partition offilesystem type, decompressing the corresponding TAR file that is backedup on the SD card, and writing all files in the TAR file into thepartition, and returning to Step D3 until traversal is completed.

The software upgrade method for a mobile terminal, wherein Step Especifically comprises:

E1. Decompressing the differential upgrade package to obtain thecorresponding differentiating file and the differentiating file list,traversing the differentiating file list, if traversal is not completed,going to Step E2; if traversal is completed, ending;

E2. Taking one item from the differentiating file list, generatingcorresponding new version files according to said differentiating fileand the old version files in the mobile terminal, writing into themobile terminal, and returning to Step E1 until traversal is completed.

A software upgrade system for a mobile terminal, wherein it comprises:

a backup list generating module for, according to the new versionsoftware and the old version software, locating partition tables of thenew version software and the old version software, respectively,comparing the difference between the new and old partition tables, andgenerating a corresponding backup list;

a differential upgrade package generating module for scanning all filesof the new version software and generating a differential upgradepackage that comprises the partition table of said new version softwareand the backup list;

a capacity detection module for, according to the backup list in saiddifferential upgrade package, detecting the total size of the backupdata to be backed up in the mobile terminal, and comparing said totalsize of the backup data with the remaining space of the SD card of themobile terminal;

a data backup and recovery module for saving the backup data to bebacked up in the mobile terminal into the SD card according to saidbackup list, re-partitioning the mobile terminal memory according tosaid partition table of the new version software in said differentialupgrade package, detecting the partition type, and correspondinglywriting the backup data on the SD card into the partition;

an upgrade module for decompressing said differential upgrade package toobtain a corresponding differentiating file, generating correspondingnew version files according to said differentiating file and the oldversion files in the mobile terminal, and writing into the mobileterminal to complete the upgrade.

The software upgrade system for a mobile terminal, wherein said backuplist generating module specifically comprises:

a partition table acquisition unit for, according to the new versionsoftware and the old version software, acquiring partition tables of thenew version software and the old version software, respectively;

a partition table traversing unit for traversing the partition table ofthe new version;

a name comparison unit for taking one item from the new partition table,and checking if a partition in the old partition table has the samename;

a size and starting address comparison unit for checking if both new andold partitions have the same size and starting address;

a backup list revising unit for checking the partition type and adding adescription item in the backup list to describe the name and type ofsaid partition.

The software upgrade system for a mobile terminal, wherein said capacitydetection module specifically comprises:

a SD card detecting unit for checking if the mobile terminal has a SDcard;

a first backup list traversing unit for acquiring the backup list fromthe differential upgrade package, reading the existing partition tablefrom the mobile terminal memory, and traversing the backup list;

a backup data total size calculation unit for taking one item from thebackup list, locating the corresponding partition in the existingpartition table, checking the partition type, if it is a partition ofraw data type, adding cumulatively the partitions until the size is upto the total size of the backup data; if it is a partition of filesystemtype, adding cumulatively the total size of all files in the partitionup to the total size of the backup data;

a capacity comparison unit for checking the size of the remaining spaceof the SD card of the mobile terminal, and comparing the total size ofthe backup data with the remaining space of the SD card of the mobileterminal.

The software upgrade system for a mobile terminal, wherein said databackup and recovery module specifically comprises:

a second backup list traversing unit for acquiring the backup list fromthe differential upgrade package, reading the existing partition tablefrom the mobile terminal memory, and traversing the backup list;

a data backup unit for taking one item from the backup list, locatingthe corresponding partition in the existing partition table, checkingthe partition type, if it is a partition of raw data type, reading datafrom the whole partition, and saving these data as one file on the SDcard; if it is a partition of filesystem type, packing files in thepartition to one file in the TAR file format, and saving this file ontothe SD card;

a third backup list traversing unit for acquiring the new partitiontable from the differential upgrade package, re-partitioning the mobileterminal memory according to the new partition table, and traversing thebackup list;

a data recovery unit for taking one item from the backup list, locatingthe corresponding partition in the new partition table, checking thepartition type, if it is a partition of raw data type, writing thecorresponding file that is backed up on the SD card into the partition;if it is a partition of filesystem type, decompressing the correspondingTAR file that is backed up on the SD card, and writing all files in theTAR file into the partition.

The software upgrade method and system for a mobile terminal accordingto the present invention effectively solve the problem that the existingFOTA mechanism is unable to handle the circumstance in which thepartition table of a mobile terminal memory needs to be revised due tosoftware version upgrade or software requirement changes, andconsequently the software cannot be upgraded, said method locates,according to the new version software and the old version software,partition tables of the new version software and the old versionsoftware, comparing differences between the new and old partitiontables, and generating a corresponding backup list; scanning all filesof the new version software and generating a differential upgradepackage that comprises the partition table of said new version softwareand the backup list; according to the backup list in said differentialupgrade package, detecting the total size of the backup data to bebacked up in the mobile terminal, and comparing said total size of thebackup data with the remaining space of the SD card of the mobileterminal, and when said total size of the backup data is smaller thanthe remaining space of the SD card of the mobile terminal, saving thebackup data to be backed up in the mobile terminal into the SD cardaccording to said backup list, re-partitioning the mobile terminalmemory according to said partition table of the new version software insaid differential upgrade package, detecting the partition type, andcorrespondingly writing the backup data on the SD card into thepartition; decompressing said differential upgrade package to obtain acorresponding differentiating file, generating corresponding new versionfiles according to said differentiating file and the old version filesin the mobile terminal, and writing into the mobile terminal to completethe upgrade, such that the mobile terminal can be upgraded even in thecircumstance that the software upgrade needs to change the memorypartition table. The implementation method thereof is simple andachieved through software, and the cost is low.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flow chart of a preferred embodiment of the software upgrademethod for a mobile terminal according to the present invention.

FIG. 2 is a flow chart of an application embodiment of generating abackup list in the software upgrade method for a mobile terminalaccording to the present invention.

FIG. 3 is a flow chart of an application embodiment of generating adifferential upgrade package in the software upgrade method for a mobileterminal according to the present invention.

FIG. 4 is a flow chart of an application embodiment of detecting thespace of a SD card in the software upgrade method for a mobile terminalaccording to the present invention.

FIG. 5 is a flow chart of an application embodiment of backing up andwriting data in the software upgrade method for a mobile terminalaccording to the present invention.

FIG. 6 is a flow chart of an application embodiment of applying thedifferential upgrade package in the software upgrade method for a mobileterminal according to the present invention.

FIG. 7 is a structural block diagram of a preferred embodiment of thesoftware upgrade system for a mobile terminal according to the presentinvention.

DETAILED DESCRIPTION OF THE EMBODIMENTS

The present invention provides a software upgrade method and system fora mobile terminal. To make the objects, technical solutions andadvantages of the present invention clearer and more specific, thepresent invention will be further described in detail below withreference to the accompanying drawings and embodiments. It should beunderstood that the specific embodiments herein are only used todescribe the present invention, rather than limit the present invention.

Please refer to FIG. 1, which is a flow chart of a preferred embodimentof the software upgrade method for a mobile terminal according to thepresent invention. As shown in FIG. 1, the software upgrade method for amobile terminal according to the present invention comprises thefollowing steps:

Step S100. According to the new version software and the old versionsoftware, locating partition tables of the new version software and theold version software, respectively, comparing the difference between thenew and old partition tables, and generating a corresponding backuplist;

Step S200. Scanning all files of the new version software and generatinga differential upgrade package that comprises the partition table ofsaid new version software and the backup list;

Step S300. According to the backup list in said differential upgradepackage, detecting the total size of the backup data to be backed up inthe mobile terminal, and comparing said total size of the backup datawith the remaining space of the SD card of the mobile terminal, and whensaid total size of the backup data is smaller than the remaining spaceof the SD card of the mobile terminal, going to Step S400;

Step S400. Saving the backup data to be backed up in the mobile terminalinto the SD card according to said backup list, re-partitioning themobile terminal memory according to said partition table of the newversion software in said differential upgrade package, detecting thepartition type, and correspondingly writing the backup data on the SDcard into the partition;

Step S500. Decompressing said differential upgrade package to obtain acorresponding differentiating file, generating corresponding new versionfiles according to said differentiating file and the old version filesin the mobile terminal, and writing into the mobile terminal to completethe upgrade.

With the mobile terminal being a cell phone as an example, the abovesteps will be described in detail below with reference to specificembodiments.

In a practical application, Steps S100 and S200 are completed at a PCend (i.e. a server), while Steps S300 to S500 are all completed in acell phone. Simply put, the PC end generates a correspondingdifferential upgrade package and sends it to the cell phone, or the cellphone downloads it, and then the software upgrade is performed in thecell phone.

In Step S100, according to the new version software and the old versionsoftware, the PC end locates partition tables of the new versionsoftware and the old version software, respectively, compares thedifference between the new and old partition tables, and generates acorresponding backup list. Specifically, the PC end obtains the new andold partition tables, respectively, according to the new versionsoftware and the old version software. The partition tables have twoforms: at a PC end, the partition table is present in the form of a“partition table description file”, which comprises partition name,partition size, partition starting address and partition type; at a cellphone end, the partition table is present in the form of “memory headerdata and memory internal partition table data”, which also comprisespartition name, partition size, partition starting address and partitiontype. Then, the PC end compares the difference between the new and oldpartition tables, and generates a corresponding backup list. Said backuplist is a list generated at the PC end, and describes which partitionsneed to be backed up. The program at the cell phone end will completethe backup action according to this list.

In a practical application, Step S100 specifically comprises: S110.Acquiring partition tables of the new version software and the oldversion software, respectively; S120. Traversing the partition table ofthe new version, if traversal is not completed, going to Step S130; iftraversal is completed, ending; S130. Taking one item from the newpartition table, and checking if a partition in the old partition tablehas the same name, if yes, going to Step S140; if no, going to StepS120; S140. Checking if both new and old partitions have the same sizeand starting address, if yes, going to Step S120; if no, going to StepS150; S150. Checking the partition type, adding a description item inthe backup list to describe the name and type of said partition, andreturning to Step S120.

Specifically, please refer to FIG. 2. FIG. 2 is a flow chart of anapplication embodiment of generating a backup list in the softwareupgrade method for a mobile terminal according to the present invention,namely a flow chart of an application embodiment of Step S100 in thesoftware upgrade method for a mobile terminal according to the presentinvention. As shown in FIG. 2, the PC end first acquires, according tothe new and old version software, partition tables of the new and oldversion software, respectively, then traverses the partition table ofthe new version, Takes one item from the new partition table, and checksif a partition in the old partition table has the same name, if yes,goes to the next step to check if both new and old partitions have thesame size and starting address, if no, continues to traverse. It checksif both new and old partitions have the same size and starting address,if yes, continues to traverse, if no, continues to check the partitiontype, and adds a description item in the backup list to describe thename and type of said partition. After adding the description item,continues to traverse until all items in the new partition table havebeen taken out, i.e. traversal is completed, and then ends.

In Step S200, the PC end scans all files of the new version software andgenerates a differential upgrade package that comprises the partitiontable of said new version software and the backup list. In a practicalapplication, Step S200 specifically comprises: S210. Scanning all filesof the new version and old version software packages and obtainingcorresponding file lists, respectively; S220. Traversing the partitiontable of the new version, if traversal is not completed, going to StepS230; if traversal is completed, adding the partition table of the newversion into the differential upgrade package, and ending; S230. Takingone item from the file list of the new version, and checking if a filein the file list of the old version has the same file name, if no,adding the file of the new version into the differential upgrade packagein a word by word manner, and going to Step S220; if yes, continuing toStep S240; S240. In a differentiating package comparison tool, usingfiles of the new and old versions as input to generate a differentiatingfile, adding a corresponding description item in the differentiatingfile, and returning to Step S220.

Specifically, please refer to FIG. 3. FIG. 3 is a flow chart of anapplication embodiment of generating a differential upgrade package inthe software upgrade method for a mobile terminal according to thepresent invention, namely a flow chart of an application embodiment ofStep S200 in the software upgrade method for a mobile terminal accordingto the present invention. As shown in FIG. 3, the PC end scans all filesof the new version and the old version to generate corresponding filelists, respectively, and then traverses the file list of the newversion, if the traversal of the file list of the new version is notcompleted, Takes one item from the file list of the new version, if thetraversal of the file list of the new version is completed, then ends.It checks if a file in the old version has the same file name as that ofthe file taken from the file list of the new version, if no, adds thefile of the new version into the differential upgrade package in a wordby word manner, updates the differential upgrade package, and continuesto traverse, if yes, uses bsdiff (a differentiating package comparisontool) as the tool, uses files of the new and old versions as input togenerate a differentiating file, and writes corresponding information,such as file name and check code, into the differentiating file list. Itcontinues to traverse until the traversal of the file list of the newversion is completed, and then adds the file list of the new versioninto the differential upgrade package.

In Step S300, according to the backup list in said differential upgradepackage, the mobile terminal detects the total size of the backup datato be backed up in the mobile terminal, compares said total size of thebackup data with the remaining space of the SD card of the mobileterminal, and when said total size of the backup data is smaller thanthe remaining space of the SD card of the mobile terminal, goes to StepS400. In a practical application, Step S300 specifically comprises:S310. Checking if the mobile terminal has a SD card, if yes, going toStep S320, if no, reporting an error, and ending; S320. Acquiring thebackup list from the differential upgrade package, reading the existingpartition table from the mobile terminal memory, traversing the backuplist, if traversal is not completed, going to Step S330; if traversal iscompleted, going to Step S340; S330. Taking one item from the backuplist, locating the corresponding partition in the existing partitiontable, checking the partition type, if it is a partition of raw datatype, adding cumulatively the partitions until the size is up to thetotal size of the backup data; if it is a partition of filesystem type,adding cumulatively the total size of all files in the partition up tothe total size of the backup data; returning to Step S320 untiltraversal is completed; S340. Checking the size of the remaining spaceof the SD card of the mobile terminal, if it is larger than the totalsize of the backup data, going to Step S400; otherwise, reporting anerror, and ending.

Specifically, please refer to FIG. 4. FIG. 4 is a flow chart of anapplication embodiment of detecting the space of a SD card in thesoftware upgrade method for a mobile terminal according to the presentinvention, namely a flow chart of an application embodiment of Step S300in the software upgrade method for a mobile terminal according to thepresent invention. As shown in the figure, the mobile terminal firstchecks if the space of the SD card is sufficient. In a practicalapplication, the mobile terminal first checks if it has a SD card, ifyes, continues, if no, reports an error, and ends. Then, it acquires thebackup list from the differential upgrade package, reads the existingpartition table from the mobile terminal memory, and initializes thevariable “total size of the backup data”. Subsequently, it traverses thebackup list, takes one item from the backup list, if traversal is notcompleted, goes to the next step; if all items have been taken out, i.e.the traversal is completed, then checks the size of the remaining spaceof the SD card. Then, according to the one item taken from the backuplist, locates the corresponding partition in the existing partitiontable, checks the partition type, if it is a partition of raw data type,adds cumulatively the partitions until the size is up to the total sizeof the backup data; if it is a partition of filesystem type, addscumulatively the total size of all files in the partition up to thetotal size of the backup data, until traversal is completed and thetotal size of the backup data to be backed up by the mobile terminal.Then, it checks the size of the remaining space of the SD card, if it islarger than the total size of the backup data, goes to Step S400 forupgrade; otherwise, reports an error, and ends. As for the method tocalculate the data size of a partition of raw data type, we are unableto know the data size in the partition since there is no META data in apartition of raw data type. Therefore, we believe that the data size inthe partition is the partition size. As for the method to calculate thedata size of a partition of filesystem type, the sizes of all files inthe partition are added up to be the data size in the partition.

In Step S400, the mobile terminal saves the backup data to be backed upin the mobile terminal into the SD card according to said backup list,re-partitions the mobile terminal memory according to said partitiontable of the new version software in said differential upgrade package,detects the partition type, and correspondingly writes the backup dataon the SD card into the partitions. In a practical application, StepS400 specifically comprises: S410. Acquiring the backup list from thedifferential upgrade package, reading the existing partition table fromthe mobile terminal memory, traversing the backup list, if traversal isnot completed, going to Step S420; if traversal is completed, going toStep S430; S420. Taking one item from the backup list, locating thecorresponding partition in the existing partition table, checking thepartition type, if it is a partition of raw data type, reading data fromthe whole partition, and saving these data as one file on the SD card;if it is a partition of filesystem type, packing files in the partitionto one file in the TAR file format, and saving this file onto the SDcard; returning to Step S410 until traversal is completed; S430.Acquiring the new partition table from the differential upgrade package,re-partitioning the mobile terminal memory according to the newpartition table, traversing the backup list, if traversal is notcompleted, going to Step S440; if traversal is completed, ending; S440.Taking one item from the backup list, locating the correspondingpartition in the new partition table, checking the partition type, if itis a partition of raw data type, writing the corresponding file that isbacked up on the SD card into the partition; if it is a partition offilesystem type, decompressing the corresponding TAR file that is backedup on the SD card, and writing all files in the TAR file into thepartition; namely, restoring the backup data on the SD card to acorresponding partition, and returning to Step S430 until traversal iscompleted.

Specifically, please refer to FIG. 5. FIG. 5 is a flow chart of anapplication embodiment of backing up and writing data in the softwareupgrade method for a mobile terminal according to the present invention,namely a flow chart of an application embodiment of Step S400 in thesoftware upgrade method for a mobile terminal according to the presentinvention. As shown in the figure, in Step S400, the cell phone backs upand restores data. The cell phone acquires the backup list from thedifferential upgrade package, and reads the existing partition tablefrom the cell phone memory. Then, it traverses the backup list, takesone item from the backup list, locates the corresponding partition inthe existing partition table, checks the partition type, if it is apartition of raw data type, reads data from the whole partition, andsaves these data as one file on the SD card; if it is a partition offilesystem type, packs files in the partition to one file in the TARfile format, and saves this file onto the SD card, until all items ofthe backup list have been taken out, i.e. the traversal is completed,and consequently all data in the cell phone to be backed up have beenbacked up to the SD card. Subsequently, it acquires the new partitiontable from the differential upgrade package, re-partitions the cellphone memory according to the new partition table, traverses the backuplist, takes one item from the backup list, locates the correspondingpartition in the new partition table, checks the partition type, if itis a partition of raw data type, writes the corresponding file that isbacked up on the SD card into the partition; if it is a partition offilesystem type, decompresses the corresponding TAR file that is backedup on the SD card, and writes all files in the TAR file into thepartition, until all items of the backup list have been taken out, i.e.the traversal is completed, and consequently the backup data on the SDcard are rewritten into the new partitions. As for the backup method fora partition of raw data type, as described above, data of the entirepartition just need to be read in the form of raw data stream and savedas one file on the SD card. As for the backup method for a partition offilesystem type, it is completed in the TAR file format. The TAR fileformat is a file packaging format that complies with the GPL license. Weuse TAR to package all files in the partition into one file and thensave this file onto a SD card.

In Step S500, the mobile terminal decompresses said differential upgradepackage to obtain a corresponding differentiating file, generatescorresponding new version files according to said differentiating fileand the old version files in the mobile terminal, and writes into themobile terminal to complete the upgrade. Specifically, Step S500specifically comprises: S510. Decompressing the differential upgradepackage to obtain the corresponding differentiating file and thedifferentiating file list, traversing the differentiating file list, iftraversal is not completed, going to Step S520; if traversal iscompleted, ending; S520. Taking one item from the differentiating filelist, generating corresponding new version files according to saiddifferentiating file and the old version files in the mobile terminal,writing into the mobile terminal, and returning to Step S510 untiltraversal is completed.

Specifically, please refer to FIG. 6. FIG. 6 is a flow chart of anapplication embodiment of applying the differential upgrade package inthe software upgrade method for a mobile terminal according to thepresent invention, namely a flow chart of an application embodiment ofStep S500 in the software upgrade method for a mobile terminal accordingto the present invention. As shown in the figure, the cell phone enddecompresses the differential upgrade package to obtain thecorresponding differentiating file and the differentiating file list,traverses the differentiating file list, takes one item from thedifferentiating file list, generates corresponding new version filesaccording to the existing files in the cell phone and thedifferentiating file, writes the new version files into the cell phoneuntil traversal is completed. In such a way, the software upgrade iscompleted for the cell phone.

The software upgrade method for a mobile terminal according to thepresent invention is an optimization method for the existing FOTAupgrade method, effectively solves the problem that software cannot beupgraded as the partition table of a cell phone memory is changed, andavoids the problem that since the existing FOTA upgrade method cannothandle this type of situations, the original partition table has to bekept, leading to more difficult development and users being unable tohave the latest and the best user experience. As a result, the mobileterminal can be upgraded even in the circumstance that the softwareupgrade needs to change the memory partition table. The implementationmethod thereof is simple and achieved through software, and the cost islow.

Based on the above software upgrade method for a mobile terminal, thepresent invention further provides a software upgrade system for amobile terminal. Please refer to FIG. 7. FIG. 7 is a structural blockdiagram of a preferred embodiment of the software upgrade system for amobile terminal according to the present invention. As shown in FIG. 7,said system comprises:

a backup list generating module 10 for, according to the new versionsoftware and the old version software, locating partition tables of thenew version software and the old version software, respectively,comparing the difference between the new and old partition tables, andgenerating a corresponding backup list; see Step S100 for details.

a differential upgrade package generating module 20 for scanning allfiles of the new version software and generating a differential upgradepackage that comprises the partition table of said new version softwareand the backup list; see Step S200 for details.

a capacity detection module 30 for, according to the backup list in saiddifferential upgrade package, detecting the total size of the backupdata to be backed up in the mobile terminal, and comparing said totalsize of the backup data with the remaining space of the SD card of themobile terminal; see Step S300 for details.

a data backup and recovery module 40 for saving the backup data to bebacked up in the mobile terminal into the SD card according to saidbackup list, re-partitioning the mobile terminal memory according tosaid partition table of the new version software in said differentialupgrade package, detecting the partition type, and correspondinglywriting the backup data on the SD card into the partition; see Step S400for details.

an upgrade module 50 for decompressing said differential upgrade packageto obtain a corresponding differentiating file, generating correspondingnew version files according to said differentiating file and the oldversion files in the mobile terminal, and writing into the mobileterminal to complete the upgrade; see Step S500 for details.

Specifically, said backup list generating module 10 locates, accordingto the new version software and the old version software, partitiontables of the new version software and the old version software,respectively, compares the difference between the new and old partitiontables, and generates a corresponding backup list. Said differentialupgrade package generating module 20 scans all files of the new versionsoftware and generates a differential upgrade package that comprises thepartition table of said new version software and the backup list. Saidcapacity detection module 30 detects, according to the backup list insaid differential upgrade package, the total size of the backup data tobe backed up in the mobile terminal, and compares said total size of thebackup data with the remaining space of the SD card of the mobileterminal, when said total size of the backup data is smaller than theremaining space of the SD card of the mobile terminal, said data backupand recovery module 40 saves the backup data to be backed up in themobile terminal into the SD card according to said backup list,re-partitions the mobile terminal memory according to said partitiontable of the new version software in said differential upgrade package,detects the partition type, and correspondingly writes the backup dataon the SD card into the partitions. Subsequently, said upgrade module 50decompresses said differential upgrade package to obtain a correspondingdifferentiating file, generates corresponding new version filesaccording to said differentiating file and the old version files in themobile terminal, and writes into the mobile terminal to complete theupgrade. In a practical application, said backup list generating module10 and said differential upgrade package generating module 20 aredisposed at the PC end, i.e. the server end. Said capacity detectionmodule 30, said data backup and recovery module 40 and said upgrademodule 50 are disposed at the mobile terminal for receiving thedifferential upgrade package from the PC end and carrying outcorresponding software upgrade.

Specifically, said backup list generating module 10 specificallycomprises:

a partition table acquisition unit for, according to the new versionsoftware and the old version software, acquiring partition tables of thenew version software and the old version software, respectively;

a partition table traversing unit for traversing the partition table ofthe new version;

a name comparison unit for taking one item from the new partition table,and checking if a partition in the old partition table has the samename;

a size and starting address comparison unit for checking if both new andold partitions have the same size and starting address;

a backup list revising unit for checking the partition type and adding adescription item in the backup list to describe the name and type ofsaid partition.

Said capacity detection module 30 specifically comprises:

a SD card detecting unit for checking if the mobile terminal has a SDcard;

a first backup list traversing unit for acquiring the backup list fromthe differential upgrade package, reading the existing partition tablefrom the mobile terminal memory, and traversing the backup list;

a backup data total size calculation unit for taking one item from thebackup list, locating the corresponding partition in the existingpartition table, checking the partition type, if it is a partition ofraw data type, adding cumulatively the partitions until the size is upto the total size of the backup data; if it is a partition of filesystemtype, adding cumulatively the total size of all files in the partitionup to the total size of the backup data;

a capacity comparison unit for checking the size of the remaining spaceof the SD card of the mobile terminal, and comparing the total size ofthe backup data with the remaining space of the SD card of the mobileterminal.

Said data backup and recovery module 40 specifically comprises:

a second backup list traversing unit for acquiring the backup list fromthe differential upgrade package, reading the existing partition tablefrom the mobile terminal memory, and traversing the backup list;

a data backup unit for taking one item from the backup list, locatingthe corresponding partition in the existing partition table, checkingthe partition type, if it is a partition of raw data type, reading datafrom the whole partition, and saving these data as one file on the SDcard; if it is a partition of filesystem type, packing files in thepartition to one file in the TAR file format, and saving this file ontothe SD card;

a third backup list traversing unit for acquiring the new partitiontable from the differential upgrade package, re-partitioning the mobileterminal memory according to the new partition table, and traversing thebackup list;

a data recovery unit for taking one item from the backup list, locatingthe corresponding partition in the new partition table, checking thepartition type, if it is a partition of raw data type, writing thecorresponding file that is backed up on the SD card into the partition;if it is a partition of filesystem type, decompressing the correspondingTAR file that is backed up on the SD card, and writing all files in theTAR file into the partition.

Since said differential upgrade package generating module 20 and saidupgrade module 50 are the same as the existing FOTA method, they willnot be described in detail herein.

In summary, the present invention provides a software upgrade method andsystem for a mobile terminal, said method locates, according to the newversion software and the old version software, partition tables of thenew version software and the old version software, respectively,compares the difference between the new and old partition tables, andgenerates a corresponding backup list; scans all files of the newversion software and generates a differential upgrade package thatcomprises the partition table of said new version software and thebackup list; according to the backup list in said differential upgradepackage, detects the total size of the backup data to be backed up inthe mobile terminal, and compares said total size of the backup datawith the remaining space of the SD card of the mobile terminal, and whensaid total size of the backup data is smaller than the remaining spaceof the SD card of the mobile terminal, saves the backup data to bebacked up in the mobile terminal into the SD card according to saidbackup list, re-partitions the mobile terminal memory according to saidpartition table of the new version software in said differential upgradepackage, detects the partition type, and correspondingly writes thebackup data on the SD card into the partitions; decompresses saiddifferential upgrade package to obtain a corresponding differentiatingfile, generates corresponding new version files according to saiddifferentiating file and the old version files in the mobile terminal,and writes into the mobile terminal to complete the upgrade, such thatthe mobile terminal can be upgraded even in the circumstance that thesoftware upgrade needs to change the memory partition table. Theimplementation method thereof is simple and achieved through software,and the cost is low, which makes it greatly convenient for users.

It should be understood that applications of the present invention arenot limited to the above examples, and to those skilled in the artimprovements or modifications may be made according to the descriptionabove, and all of these improvements and modifications shall beencompassed by the appended claims of the present invention.

1. A software upgrade method for a mobile terminal, the methodcomprising: according to a new version of software and an old versionsoftware, locating partition tables of the new version of software andthe old version of software, respectively, comparing a differencebetween new and old partition tables, and generating a correspondingbackup list; scanning all files of the new version of software andgenerating a differential upgrade package that comprises a partitiontable, of said new version software, and a backup list; according to thebackup list in said differential upgrade package, detecting a total sizeof backup data to be backed up in the mobile terminal, and comparingsaid total size of the backup data with a remaining space of a SD cardof the mobile terminal, and when said total size of the backup data issmaller than the remaining space of the SD card of the mobile terminal;saving the backup data into the SD card according to said backup list,re-partitioning a mobile terminal memory according to said partitiontable of the new version of software in said differential upgradepackage, detecting a partition type, and correspondingly writing thebackup data on the SD card into the partition; and decompressing saiddifferential upgrade package to obtain a corresponding differentiatingfile, generating corresponding new version files according to saiddifferentiating file and old version files in the mobile terminal, andwriting the new version files into the mobile terminal.
 2. The softwareupgrade method for a mobile terminal according to claim 1, furthercomprising: according to the new version of software and the old versionof software, acquiring partition tables of the new version of softwareand the old version of software, respectively; traversing the partitiontable of the new version of software, if traversal is not completedtaking one item from the new partition table and checking if a partitionin the old partition table has the same name, checking if both new andold partitions have a same size and starting address.
 3. The softwareupgrade method for a mobile terminal according to claim 1, furthercomprising: scanning all files of the new version of software and oldversion of software and obtaining corresponding file lists; traversing apartition table of the new version of software, if traversal iscompleted, adding the partition table of the new version into thedifferential upgrade package, and ending; if traversal is not completedtaking one item from a file list of the new version of software, andchecking if a file in a file list of the old version of software has asame file name, if a file in the file list of the old version ofsoftware does not have the same file name, adding the file of the newversion of software having the same name into the differential upgradepackage in a word by word manner, and further traversing the partitiontable of the new version of software; if a file in the file list of theold version of software has the same file name, in a differentiatingpackage comparison tool, using files of the new version of software andold version of software as input to generate a differentiating file,adding a corresponding description item in the differentiating file, andfurther traversing the partition table of the new version of software.4. The software upgrade method for a mobile terminal according to claim1, further comprising: checking if the mobile terminal has a SD card, ifthe mobile terminal has a SD card acquiring the backup list from thedifferential upgrade package, reading an existing partition table fromthe mobile terminal memory, traversing the backup list and, if traversalis not completed, taking one item from the backup list, locating acorresponding partition in the existing partition table, checking apartition type, if the partition type is a partition of raw data type,adding cumulatively the partitions until a size is up to a total size ofthe backup data; if the partition type is a partition of filesystemtype, adding cumulatively a total size of all files in the partition upto the total size of the backup data, and further traversing thepartition table of the new version of software; and if traversal iscompleted checking a size of a remaining space of the SD card of themobile terminal, if the size of the remaining space of the SD card islarger than a total size of backup data, saving the backup data to bebacked up in the mobile terminal into the SD card according to saidbackup list; and if the size of the remaining space of the SD card islarger than a total size of backup data, reporting an error, and ending.5. The software upgrade method for a mobile terminal according to claim1, further comprising: acquiring the backup list from the differentialupgrade package, reading an existing partition table from a mobileterminal memory, traversing the backup list, if traversal is notcompleted, taking one item from the backup list, locating acorresponding partition in an existing partition table, checking apartition type, if the partition type is a partition of raw data type,reading data from a whole partition, and saving associated data as onefile on the SD card; if the partition type is a partition of filesystemtype, packing files in the partition to one file in a TAR file format,and saving this file onto the SD card, and further traversing the backuplist; if traversal is completed, acquiring a new partition table fromthe differential upgrade package, re-partitioning the mobile terminalmemory according to the new partition table, traversing the backup list,if traversal is not completed, taking one item from the backup list,locating a corresponding partition in the new partition table, checkingthe partition type, if the partition type is a partition of raw datatype, writing the corresponding file that is backed up on the SD cardinto the partition; if the partition type is a partition of filesystemtype, decompressing a corresponding TAR file that is backed up on the SDcard, and writing all files in the TAR file into the partition, andfurther traversing the backup list.
 6. The software upgrade method for amobile terminal according to claim 1, further comprising: decompressingthe differential upgrade package to obtain a correspondingdifferentiating file and a differentiating file list, traversing thedifferentiating file list, if traversal is not completed, taking oneitem from the differentiating file list, generating corresponding newversion files according to said differentiating file and to the oldversion files in the mobile terminal, writing into the mobile terminal,and further traversing the backup list.
 7. A software upgrade method fora mobile terminal, the method comprising: according to a new version ofsoftware and an old version software, locating partition tables of thenew version of software and the old version of software, respectively,comparing a difference between new and old partition tables, andgenerating a corresponding backup list; scanning all files of the newversion of software and generating a differential upgrade package thatcomprises a partition table, of said new version software, and a backuplist; according to the backup list in said differential upgrade package,detecting a total size of backup data to be backed up in the mobileterminal, and comparing said total size of the backup data with aremaining space of a SD card of the mobile terminal, and when said totalsize of the backup data is smaller than the remaining space of the SDcard of the mobile terminal saving the backup data into the SD cardaccording to said backup list, re-partitioning a mobile terminal memoryaccording to said partition table of the new version of software in saiddifferential upgrade package, detecting a partition type, andcorrespondingly writing the backup data on the SD card into thepartition; and decompressing said differential upgrade package to obtaina corresponding differentiating file, generating corresponding newversion files according to said differentiating file and old versionfiles in the mobile terminal, and writing the new version files into themobile terminal; wherein, the partition table has two forms: at a PCend, the partition table is present in a form of a partition tabledescription file, which comprises a partition name, a partition size, apartition starting address and a partition type; at a cell phone end,the partition table is present in a form of memory header data andmemory internal partition table data, which also comprises a partitionname, a partition size, a partition starting address and a partitiontype; the PC end compares a difference between the new and old partitiontables, and generates a corresponding backup list; decompressing thedifferential upgrade package to obtain a corresponding differentiatingfile and a differentiating file list, traversing the differentiatingfile list, if traversal is not completed, taking one item from thedifferentiating file list, generating corresponding new version filesaccording to said differentiating file and to the old version files inthe mobile terminal, writing into the mobile terminal, and furthertraversing the backup list.
 8. The software upgrade method for a mobileterminal according to claim 7, further comprising: according to the newversion of software and the old version of software, acquiring partitiontables of the new version of software and the old version of software,respectively; traversing the partition table of the new version ofsoftware, if traversal is not completed taking one item from the newpartition table and checking if a partition in the old partition tablehas the same name, if checking if both new and old partitions have asame size and starting address.
 9. The software upgrade method for amobile terminal according to claim 7, further comprising: scanning allfiles of the new version of software and old version of software andobtaining corresponding file lists; traversing a partition table of thenew version of software, if traversal is completed, adding the partitiontable of the new version into the differential upgrade package, andending; if traversal is not completed taking one item from the file listof the new version of software, and checking if a file in the file listof the old version of software has the same file name, if a file in thefile list of the old version of software does not have the same filename, adding the file of the new version of software having the samename into the differential upgrade package in a word by word manner, andfurther traversing the partition table of the new version of software;if a file in the file list of the old version of software has the samefile name, in a differentiating package comparison tool, using files ofthe new version of software and old version of software as input togenerate a differentiating file, adding a corresponding description itemin the differentiating file, and further traversing the partition tableof the new version of software.
 10. The software upgrade method for amobile terminal according to claim 7, further comprising: checking ifthe mobile terminal has a SD card, if the mobile terminal has a SD cardacquiring the backup list from the differential upgrade package, readingan existing partition table from the mobile terminal memory, traversingthe backup list and, if traversal is not completed, taking one item fromthe backup list, locating a corresponding partition in the existingpartition table, checking a partition type, if the partition type is apartition of raw data type, adding cumulatively the partitions until thesize is up to the total size of the backup data; if the partition typeis a partition of filesystem type, adding cumulatively the total size ofall files in the partition up to the total size of the backup data, andfurther traversing the partition table of the new version of software;and if traversal is completed checking a size of a remaining space ofthe SD card of the mobile terminal, if the size of the remaining spaceof the SD card is larger than a total size of backup data saving thebackup data to be backed up in the mobile terminal into the SD cardaccording to said backup list; and if the size of the remaining space ofthe SD card is larger than a total size of backup data, reporting anerror, and ending.
 11. The software upgrade method for a mobile terminalaccording to claim 7, further comprising: acquiring the backup list fromthe differential upgrade package, reading an existing partition tablefrom a mobile terminal memory, traversing the backup list, if traversalis not completed, taking one item from the backup list, locating acorresponding partition in the existing partition table, checking apartition type, if the partition type is a partition of raw data type,reading data from a whole partition, and saving associated data as onefile on the SD card; if the partition type is a partition of filesystemtype, packing files in the partition to one file in a TAR file format,and saving this file onto the SD card, and further traversing the backuplist; if traversal is completed, acquiring a new partition table fromthe differential upgrade package, re-partitioning the mobile terminalmemory according to the new partition table, traversing the backup list,if traversal is not completed, taking one item from the backup list,locating a corresponding partition in the new partition table, checkingthe partition type, if the partition type is a partition of raw datatype, writing the corresponding file that is backed up on the SD cardinto the partition; if the partition type is a partition of filesystemtype, decompressing a corresponding TAR file that is backed up on the SDcard, and writing all files in the TAR file into the partition, andfurther traversing the backup list.
 12. The software upgrade method fora mobile terminal according to claim 7, further comprising:decompressing the differential upgrade package to obtain a correspondingdifferentiating file and a differentiating file list, traversing thedifferentiating file list, if traversal is not completed, taking oneitem from the differentiating file list, generating corresponding newversion files according to said differentiating file and to the oldversion files in the mobile terminal, writing into the mobile terminal,and further traversing the backup list.
 13. A software upgrade systemfor a mobile terminal, the system comprising: a backup list generatingmodule for, according to a new version of software and a old version ofsoftware, locating partition tables of the new version of software andthe old version of software, comparing a difference between the new andold partition tables, and generating a corresponding backup list; adifferential upgrade package generating module for scanning all files ofthe new version of software and generating a differential upgradepackage that comprises the partition table of said new version ofsoftware and the backup list; a capacity detection module for, accordingto the backup list in said differential upgrade package, detecting atotal size of backup data to be backed up in the mobile terminal, andcomparing said total size of the backup data with a remaining space ofan SD card of the mobile terminal; a data backup and recovery module forsaving the backup data to be backed up in the mobile terminal into theSD card according to said backup list, re-partitioning a mobile terminalmemory according to said partition table of the new version of softwarein said differential upgrade package, detecting a partition type, andcorrespondingly writing the backup data on the SD card into thepartition; an upgrade module for decompressing said differential upgradepackage to obtain a corresponding differentiating file, generatingcorresponding new version files according to said differentiating fileand old version files in the mobile terminal, and writing the newversion files into the mobile terminal.
 14. The software upgrade systemfor a mobile terminal according to claim 13, further comprising: apartition table acquisition unit for, according to the new version ofsoftware and the old version of software, acquiring partition tables ofthe new version of software and the old version of software; a partitiontable traversing unit for traversing a partition table of the newversion of software; a name comparison unit for taking one item from thenew partition table, and checking if a partition in an old partitiontable has a same name; a size and starting address comparison unit forchecking if both new and old partitions have a same size and startingaddress; and a backup list revising unit for checking a partition typeand adding a description item in the backup list to describe a name andtype of said partition.
 15. The software upgrade system for a mobileterminal according to claim 13, further comprising: a SD card detectingunit for checking if the mobile terminal has a SD card; a first backuplist traversing unit for acquiring the backup list from the differentialupgrade package, reading the existing partition table from a mobileterminal memory, and traversing the backup list; a backup data totalsize calculation unit for taking one item from the backup list, locatinga corresponding partition in an existing partition table, checking apartition type, if the partition type is a partition of raw data type,adding cumulatively the partitions until a size is up to a total size ofbackup data; if the partition type is a partition of filesystem type,adding cumulatively the total size of all files in the partition up tothe total size of the backup data; and a capacity comparison unit forchecking a size of the remaining space of the SD card of the mobileterminal, and comparing the total size of the backup data with theremaining space of the SD card of the mobile terminal.
 16. The softwareupgrade system for a mobile terminal according to claim 13, furthercomprising: a second backup list traversing unit for acquiring a backuplist from a differential upgrade package, reading an existing partitiontable from a mobile terminal memory, and traversing the backup list; adata backup unit for taking one item from the backup list, locating acorresponding partition in an existing partition table, checking apartition type, if the partition type is a partition of raw data type,reading data from a whole partition, and saving associated these data asone file on the SD card; if the partition type is a partition offilesystem type, packing files in the partition to one file in a TARfile format, and saving this file onto the SD card; a third backup listtraversing unit for acquiring a new partition table from thedifferential upgrade package, re-partitioning the mobile terminal memoryaccording to the new partition table, and traversing the backup list;and a data recovery unit for taking one item from the backup list,locating a corresponding partition in the new partition table, checkingthe partition type, if the partition type is a partition of raw datatype, writing the corresponding file that is backed up on the SD cardinto the partition; if the partition type is a partition of filesystemtype, decompressing the corresponding TAR file that is backed up on theSD card, and writing all files in the TAR file into the partition. 17.The software upgrade method for a mobile terminal according to claim 2,further comprising: if a partition in the old partition table does nothave the same name, traversing the partition table of the new version ofsoftware.
 18. The software upgrade method for a mobile terminalaccording to claim 2, further comprising: checking if both the new andthe old partitions have a same size and starting address and, if the newand the old partitions do not have the same size and starting address,checking the partition type, adding a description item in the backuplist to describe the name and type of said partition, and traversing thepartition table of the new version of software.
 19. The software upgrademethod for a mobile terminal according to claim 2, further comprising:checking if both the new and the old partitions have a same size andstarting address and, if the new and the old partitions have the samesize and starting address, traversing the partition table of the newversion of software.
 20. The software upgrade method for a mobileterminal according to claim 8, further comprising: checking if both thenew and the old partitions have a same size and starting address and, ifthe new and the old partitions do not have the same size and startingaddress, checking the partition type, adding a description item in thebackup list to describe the name and type of said partition, andtraversing the partition table of the new version of software.